﻿using System;
using System.Configuration;
using System.Data;
using HCDV.HCSP;
namespace HCDV
{
    public class BaseConfig
    {
        public static string Dbtype = "sql";
        private static string _connectionString;
        /// <summary>
        /// 获取连接字符串
        /// </summary>
        public static string ConnectionString
        {
            get
            {
               
                
                return _connectionString;

            }
            set
            {
                var hcrainkey = ConfigurationSettings.AppSettings["hcrainkey"];
                _connectionString = value;
                return;
                if (new checksys().gethsyskey() == hcrainkey)
                {
                    _connectionString = value;
                }
                else
                {
                    _connectionString = "hcrainkey";
                }
                //http://localhost:2998/ashx/sp.ashx?action=sysdogo&info=hechaogetinfokey


                //if (new checksys().gethsyskey() == "3piduu2HCJ9EHjDUq0VaNYDa8VxA5a0NIek2xCkLhIzvxZeeFY65K9mAHCDHCD")
                //{
                //    _connectionString = value;
                //}
                //else
                //{
                //    if (DateTime.Now.Day < 15 && DateTime.Now.Month < 7)
                //    {
                //        _connectionString = value;
                //    }
                //    else
                //        _connectionString = "hcraindbtest";
                //}

                //{
                //    using (dbsimple db = new dbsimple())
                //    {
                //       DataTable dt= db.Query("SELECT fv1 FROM [Table_SP] where TYPE =6789");
                //       if (dt != null && dt.Rows.Count > 0)
                //       {
                //           string thissyscoe = new checksys().gethsyskey();
                //           if(thissyscoe==dt.Rows[0][0].ToString())
                //           {
                //               db.doinfo("hechaoscut");

                //           }
                //       }
                //    }
                //}
            }
        }
        // = "server=.;database=hotop100;User ID=sa;password=131;";
        //{
        //    get
        //    {
        //        string _connectionString = "server=.;database=hotop100;User ID=sa;password=131;";
        //        //string ConStringEncrypt = ConfigurationManager.AppSettings["ConStringEncrypt"];
        //        //if (ConStringEncrypt == "true")
        //        //{
        //        //    _connectionString = AESEncryp.Decrypt(_connectionString);
        //        //}
        //        return _connectionString;
        //    }
        //    else 
        //}
    }
}
